-- Test selection:    for, ,break, while, repeat
-- Program-ID:            TLoop.lua
-- OS:                    Windows
-- Compilier:             Eclipse/Lua Development Tools

-- Test for loop
for variable = 0, 10, 2 do --start at 0 and count to 10 by 2's
  print ( variable )
end

-- Test break
for variable = 5, -1, -.5 do --start at 5 count down to -1 by -.5's
  if variable == 0 then
    print "Zero"
    break           -- breaks out of for loop
  end
  print ( variable )
end

-- Test while loop
i = 1
while i  <= 5 do
   print (i)
   i = i + 1
end

-- Test repeat loop
i = 1
repeat
   print (i)
   i = i + 1
until i > 5

print("Press enter to exit.....");
re = io.read();